package com.example.museum.controller;

import com.example.museum.common.Result;
import com.example.museum.entity.Employee;
import com.example.museum.service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 员工
 */

@RestController
@RequestMapping("employee")
@Slf4j
public class EmployeeController {


    @Autowired
    private EmployeeService employeeService;

    /**
     *  员工登录
     * @param employee
     * @return
     */
    @PostMapping("login")
    public Result<Employee> login(@RequestBody Employee employee){
        log.info("当前登录的员工账号为:{}",employee.getUsername());
       Employee employeeLogin = employeeService.login(employee);
       return Result.success(employeeLogin);
    }

}
